package cn.lu.train.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import butterknife.ButterKnife;
import cn.lu.train.util.ActivityManager;

/**
 * Created by luxianyue on 2018/3/12.
 */

public abstract class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayout());
        ButterKnife.bind(this);
        ActivityManager.get().put(this);

        onCreated();
        initData();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityManager.get().remove(getClass());
    }

    public void initData(){

    }

    public void showLoading() {

    }

    public void hiddenLoading() {

    }

    public abstract int getLayout();

    protected abstract void onCreated();
}
